
const state = {//数据
  isLoading: true,
  localUserInfo: {},
  tablesOfAll: [],
  usersByDepart_all:[],
  usersByDepart_subscribe:[],
  usersByDepart_present:[],
  usersByDepart_performance:[],
  businessHours:{},
  subscribe_roomTypeList:[]
}

const getters = {//获取数据
  /*getLoadingStatus: function (state) {
    return state.isLoading
  }*/
  getLoadingStatus: state => state.isLoading,//es6箭头函数写法
  getLocalUserInfo: state => state.localUserInfo,
  getTablesOfAll: state => state.tablesOfAll,
  getUsersByDepart_all: state => state.usersByDepart_all,
  getUsersByDepart_subscribe: state => state.usersByDepart_subscribe,
  getUsersByDepart_present: state => state.usersByDepart_present,
  getUsersByDepart_performance: state => state.usersByDepart_performance,
  getBusinessHours: state => state.businessHours,
  getSubscribe_roomTypeList: state => state.subscribe_roomTypeList
}

const mutations = {//对本地无需ajax的更改，使用mutations
  updateLoadingStatus (state, changed) {
    state.isLoading = changed.isLoading
  },
  updateLocalUserInfo (state, changed) {
    state.localUserInfo = changed
  },
  updateTablesOfAll (state, changed) {
    state.tablesOfAll = changed
  },
  updateUsersByDepart_all(state,changed){
    state.usersByDepart_all = changed
  },
  updateUsersByDepart_subscribe(state,changed){
    state.usersByDepart_subscribe = changed
  },
  updateUsersByDepart_present(state,changed){
    state.usersByDepart_present = changed
  },
  updateUsersByDepart_performance(state,changed){
    state.usersByDepart_performance = changed
  },
  updateBusinessHours(state,changed){
    state.businessHours = changed
  },
  updateSubscribe_roomTypeList(state,changed){
    state.subscribe_roomTypeList = changed
  }
}

const actions = {//action好处适合异步操作，action先执与后端交互，mutations后执行
}

export default {
  state,
  getters,
  mutations,
  actions
}
